<?php

/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2017/7/4
 * Time: 11:20
 */

namespace app\common\model;


class User extends Basemodel
{

    protected $autoWriteTimestamp = true;
    protected $auto = ['last_login_ip'];
    protected $insert = ['status' => 0];
    protected $update = [];

    public function setLastLoginIpAttr()
    {
        return request()->ip();
    }

    /**
     * 登陆的时间
     * @param $data
     * @param $id
     * @return false|int
     */
    public function updatalosttime($data, $id)
    {
        return $this->allowField(true)->save($data, ['id' => $id]);
    }


}